<?php

/**
 * Login form.
 *
 * @package    Redsea20
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class LoginForm extends BaseLoginForm
{
  public function configure()
  {
      $this->disableCSRFProtection();
      
      $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'entityid'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Entity'), 'add_empty' => false)),
      'emailaddress'   => new sfWidgetFormTextarea(),
      'password'   => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'entityid'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Entity'))),
      'emailaddress'   => new sfValidatorString(),
      'password'   => new sfValidatorString(),
    ));

    $this->widgetSchema->setNameFormat('login[%s]');
  }
}
